<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>添加基础信息</title>
		<link rel="stylesheet" type="text/css" href="../../css/jquery-ui.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/form.css"/>
	</head>
	<body>
		<!-- 蓝色背景区域 -->
		<div class="wrap">
			<!-- 白色可用区域 -->
			<div class="canuse">
				<!------ 位置 ------>
	            <p class="contentText local"><span>位置：基础信息管理 > 物资基本信息 > 添加物资基础信息</span></p>
	            
			    	<div class="article_list" style="width: 98.5%; margin: 0px auto;">
			            <!------- 内容 ------->
			            <div class="content content1">
			                <!-- 用户列表内容区 -->
			                <div class="con con_01">
			                    <!-- 表单信息填写区 -->
			                    <h4 class="sel_title"><img src="../../img/list/brand1.png" /><span>填写物资基础信息</span><span class="necessary">（带*号为必填项）</span></h4>
			                    <div class="write_area">
			                        <form id="addFrom" action="" method="post">
			                            <table class="contentText" border="1" cellspacing="0" cellpadding="0" width="99%">
			                                <tbody>
			                                    <tr>
			                                        <th>物资名称：</th>
			                                        <td>
														<input id="name" name="" type="text" value=""> <span class="redColor">*</span>
														<br><span id="nameError"></span>
			                                        </td>
			                                        <th>物资编号：</th>
			                                        <td>
														<input id="number" name="" type="text" value=""> <span class="redColor">*</span>
														<br><span id="numberError"></span>
			                                        </td>
			                                        <th>物资类型：</th>
			                                        <td>
			                                        	<select name="" id="type">
			                                        		<option value="类型1">类型1</option>
			                                        		<option value="类型2">类型2</option>
			                                        		<option value="类型3">类型3</option>
														</select> <span class="redColor">*</span>
														<br><span id="typeError"></span>
			                                        </td>
			                                    </tr>
												
			                                    <tr>
													<th>规格型号：</th>
			                                        <td>
														<input id="model" name="" type="text" value=""> <span class="redColor">*</span>
														<br><span id="modelError"></span>
			                                        </td>
													<th>计量单位：</th>
			                                        <td>
														<input id="measure" name="" type="text" value=""> <span class="redColor">*</span>
														<br><span id="measureError"></span>
			                                        </td>
			                                    	<th>是否有效期：</th>
			                                        <td>
			                                        	<select id="isEnable">
			                                        		<option value="">是</option>
			                                        		<option value="">否</option>
			                                        	</select> <span class="redColor">*</span>
			                                        </td>
			                                        
			                                    </tr>
			                                    <tr>
													<th>所属仓库：</th>
			                                        <td>
			                                        	<select id="storeHouse">
			                                        		<option value="">盘状物料库</option>
			                                        		<option value="">网板库</option>
															<option value="">其他仓库</option>
			                                        	</select> <span class="redColor">*</span>
			                                        </td>													
													
													<th></th>
			                                        <td>
			                                        </td>
			                                        
			                                    </tr>
			                                </tbody>
			                            </table>
			                        </form>
			                        <!-- 保存、重置按钮区 -->
			                        <div align="center" class="btn_submit">
			                            <a class="bgd_blue_two img_hand contentText" onclick="submit()">确定</a>
			                            <a href="material-info.html" class="bgd_white_two img_hand"> 返回 </a>
			                        </div>
			                    </div>
			                </div>
			            </div>
			        </div>
				</div>
	            
			</div>
			
			<!-- 版尾  -->
			<!--<div class="ending currentYear"></div>-->
		</div>
	</body>
	<script src="../../js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/3rd/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/frame/common.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var h = document.documentElement.clientHeight;
		$(".wrap").css("height", h);
		
		// 获取每行 td 的兄弟节点
		$(".info_area td").hover(   
			function () {      
				$(this).parent().children().addClass("td_hover");   
			},    
			function () {      
				$(this).parent().children().removeClass("td_hover");   
			}
		);
		
		// 日期控件
		$(".dateControl").datepicker({
			dateFormat : 'yy-mm-dd',
		    monthNamesShort:["January","February","March","April","May","June", "July","August","September","October","November","December"],
		   	changeYear:true,
		   	changeMonth:true,
		   	showOn:"button",
		   	buttonImage:"../../img/list/calendar.png",
		   	buttonImageOnly:false
		});

		function submit() {

			var name = $.trim($("#name").val());
			if (name) {
				$("#nameError").html("");
			} else {
				$("#nameError").html("物资名称不可以为空");
				$("#nameError").css("color", "red");
				return;
			}

			var number = $.trim($("#number").val());
			if (number) {
				$("#numberError").html("");
			} else {
				$("#numberError").html("物资编号不可以为空");
				$("#numberError").css("color", "red");
				return;
			}

			var reg=/^\d+$/;

			if(reg.test(number)==true){
				$("#numberError").html("");
			}else{
				$("#numberError").html("物资编号必须为数字");
				$("#numberError").css("color", "red");
				return;
			}

			var type = $.trim($("#type").val());
			if (type) {
				$("#typeError").html("");
			} else {
				$("#typeError").html("物资类型不可以为空");
				$("#typeError").css("color", "red");
				return;
			}

			var type = $.trim($("#type").val());
			if (type) {
				$("#typeError").html("");
			} else {
				$("#typeError").html("物资类型不可以为空");
				$("#typeError").css("color", "red");
				return;
			}

			var model = $.trim($("#model").val());
			if (model) {
				$("#modelError").html("");
			} else {
				$("#modelError").html("规格型号不可以为空");
				$("#modelError").css("color", "red");
				return;
			}

			var measure = $.trim($("#measure").val());
			if (measure) {
				$("#measureError").html("");
			} else {
				$("#measureError").html("规格型号不可以为空");
				$("#measureError").css("color", "red");
				return;
			}

			var measure = $.trim($("#measure").val());
			if (measure) {
				$("#measureError").html("");
			} else {
				$("#measureError").html("计量单位不可以为空");
				$("#measureError").css("color", "red");
				return;
			}
			window.location="material-info.html";
			
		}

	
	</script>
</html>
